package com.xckj.cycling.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;

import androidx.annotation.Nullable;

import com.just.agentweb.AgentWebUtils;
import com.just.agentweb.BaseIndicatorView;
import com.wang.avi.AVLoadingIndicatorView;
import com.xckj.cycling.R;

public class CustomIndicatorLayout extends BaseIndicatorView {
    private static final String TAG = CustomIndicatorLayout.class.getSimpleName();
    private View mCoolIndicator;
    private AVLoadingIndicatorView indicatorView;

    public CustomIndicatorLayout(Context context) {
        this(context, null);
    }

    public CustomIndicatorLayout(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, -1);
    }

    public CustomIndicatorLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        mCoolIndicator = LayoutInflater.from(context).inflate(R.layout.layout_loading_gray, this);
//        ImageView iv_loading = mCoolIndicator.findViewById(R.id.iv_loading);
//        //GlideArms.with(context).load(R.drawable.icon_32px).circleCrop().into(iv_loading);
//        Picasso.get().load(R.drawable.icon_76px)
//                .transform(new CircleTransform())
//                .resize(SizeUtils.dp2px(40), SizeUtils.dp2px(40))
//                .centerCrop().into(iv_loading);
    }


    @Override
    public void hide() {
        this.setVisibility(View.GONE);

    }

    @Override
    public void show() {
        this.setVisibility(View.VISIBLE);

    }

    @Override
    public LayoutParams offerLayoutParams() {
        int width = AgentWebUtils.dp2px(getContext(), 100);
        int height = AgentWebUtils.dp2px(getContext(), 100);
        LayoutParams params = new FrameLayout.LayoutParams(width, height);
        params.gravity = Gravity.CENTER;
        return params;
    }
}
